/*******************************************************************************
*
* (c) Copyright 2014 Freescale Semiconductor
*
****************************************************************************//*!
*
* @file     SIM.h
*
* @author   Salvador Zendejas
*
* @version  0.0.1
*
* @date      Aug 22, 2014
*
* @brief    System Integration Module configuration for Kinetis K.
*
*******************************************************************************/
#ifndef TASKS_H_
#define TASKS_H_
/*******************************************************************************
* Includes
*******************************************************************************/
#include "derivative.h" /* Include peripheral declarations */
#include "../typedef.h"


/*******************************************************************************
* Constants and macros
*******************************************************************************/
#define NAME_LENGHT_MAX		10
#define MAX_TASK_LOAD		6
#define Priority_DEFAULT	10

#define STACK1_SIZE			60
#define STACK2_SIZE			60
#define STACK3_SIZE			60
#define STACK4_SIZE			60
/*******************************************************************************
* Types Definitions
*******************************************************************************/
typedef enum{
	_ID00,
	_ID01,
	_ID02,
	_ID03,
	_ID04,
	_ID05,
	_ID06,
	_ID07,
	_ID08,
	_ID09,
	_ID10,
}eID_Task_t; /* Could increase to uint16_t */

typedef enum{
	_Running,
	_Ready,
	_Blocked,
	_Terminate
}eStatusTask_t; /* Each of status allowed for the Task */

typedef struct sTaskObject{
	uint8_t  u8_Name[NAME_LENGHT_MAX];
	eID_Task_t e_IDTask;
	uint8_t  u8_Priority;
	uint32_t u32_StackAddr;
	tPointerFcn t_ptrFn;
	eStatusTask_t t_Status;
}sTaskObject_t;


extern sTaskObject_t t_TaskObjArr[MAX_TASK_LOAD];
extern uint8_t u8_IndexTaskObj;
extern uint8_t u8_gActualTaskRunning;

/*******************************************************************************
* Global function prototypes
*******************************************************************************/
void TASK_Iddle (void);
void TASK_1 (void);
void TASK_2 (void);
void TASK_3 (void);
void TASK_4 (void);

/*******************************************************************************
* Local function prototypes
*******************************************************************************/



#endif /* TASKS_H_ */
